package com.taorenqi.business.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.taorenqi.business.R;
import com.taorenqi.business.app.MyApp;
import com.taorenqi.business.helper.RecyclerViewHolder;
import com.taorenqi.business.widget.labelview.LabelLinearLayoutView;
import com.taorenqi.data.entity.mine.RechargeRecordEntity;
import com.taorenqi.data.entity.mine.RechargeRecordVipEntity;

import java.util.List;

/**
 * Created by eric on 2017/9/8.
 */

public class RechargeRecordVipAdapter extends BaseQuickAdapter<RechargeRecordVipEntity,RecyclerViewHolder> {



    public RechargeRecordVipAdapter(List<RechargeRecordVipEntity> commonEntityList) {
        super(R.layout.item_recyclerview_recharge_record,commonEntityList);

    }
    @Override
    protected void convert(final RecyclerViewHolder helper, RechargeRecordVipEntity item) {
        if (item != null){

            helper
                    .setText(R.id.item_record_time,item.getAdddate())
                    .setText(R.id.item_record_odd_number,item.getShop_vip_number() + "")
                    .setText(R.id.item_record_money,item.getShop_vip_money()+ "")
                    .setText(R.id.item_record_type, "业务类型：购买会员" + item.getShop_vip_month() + "个月")
            ;

            if ( 2 == item.getSign()){
                ((LabelLinearLayoutView) helper.getView(R.id.item_record_ll_labelview))
                        .setLabelText("充值失败")
                ;
                ((LabelLinearLayoutView) helper.getView(R.id.item_record_ll_labelview))
                        .setLabelBackgroundColor(MyApp.getApp().getResources().getColor(R.color.recharge_fail));
            }else if (3 == item.getSign()){
                ((LabelLinearLayoutView) helper.getView(R.id.item_record_ll_labelview))
                        .setLabelText("充值成功")
                ;

                ((LabelLinearLayoutView) helper.getView(R.id.item_record_ll_labelview))
                        .setLabelBackgroundColor(MyApp.getApp().getResources().getColor(R.color.recharge_success));
            }

        }
    }
}
